<?php
/**
 * Copyright (c) 2006, PORTALIER Julien
 * 
 * Licensed under The LGPL License
 * Redistributions of files must retain the above copyright notice.
 * 
 * To use you'll need to download SwiftMailer 2.1.x from http://swiftmailer.org
 * and unpack it in /vendors/swift/
 * 
 * @package      Feather-CM
 * @subpackage   Components
 * @copyright    Copyright (c) 2006, Julien PORTALIER
 * @link         http://julien.portalier.com
 * @license      http://www.opensource.org/licenses/lgpl-license.php The LGPL License
 */

define('PUBLISH_DRAFT',  -1);
define('PUBLISH_PRIVATE', false);
define('PUBLISH_ONLINE',  true);

class PublishComponent
{
	function startup(Controller $controller)
	{
		$this->status = array(
#			PUBLISH_DRAFT   => _('Draft'),
			PUBLISH_ONLINE  => _('Published'),
			PUBLISH_PRIVATE => _('Private'),
		);
	}
	
	function getStatus($status, $created=null)
	{
		if ($created < Timer::SQL())
		{
			if ($status == PUBLISH_ONLINE)
				return;
			switch ($status)
			{
				case PUBLISH_DRAFT:   $class = 'draft';   break;
				case PUBLISH_WAITING: $class = 'waiting'; break;
				case PUBLISH_PRIVATE: $class = 'private';
			}
			$text = $this->status[$status];
		}
		else
		{
			$text  = _('Pre-Published');
			$class = 'future';
		}
		return "<span class=\"$class\"><span>[$text]</span></span>";
	}
	
	/*
	function getClass($state, $in_future=false)
	{
		if ($in_future)
			$class = 'publishPrivate';
		else
		{
			switch($state)
			{
				case PUBLISH_DRAFT:   $class = 'publishDraft';   break;
				case PUBLISH_WAITING: $class = 'publishWaiting'; break;
				case PUBLISH_PRIVATE: $class = 'publishPrivate';
			}
		}
		return isset($class) ? "class=\"$class\"" : null;
	}
	*/
}
?>